package com.example.product.biz.domain.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

@Data
public class CategoryAddDTO {
    @Schema(description = "分类名称",example = "食品")
    @NotBlank(message = "分类名称不能为空")
    @Size(min = 1, max = 50, message = "分类名称长度需为2-50字符")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5a-zA-Z0-9\\-_\\(\\)\\s]+$",
             message = "分类名称仅支持中文、字母、数字及-_()符号")
    private String name;

    @Schema(description = "父类id",example = "0")
    @NotNull(message = "父分类ID不能为null")
    @Min(value = 0, message = "父分类ID最小值为0")
    private Long parentId;

    @Schema(description = "排序",example = "1")
    @Min(value = 0, message = "排序值最小为0")
    @Max(value = 999, message = "排序值最大为999")
    private Integer sort = 0;

    @Schema(description = "图标",example = "https://big-project-tree.oss-cn-beijing.aliyuncs.com/tree/39ffb511-5f49-48b2-8aa9-29a8b2914318.jpg")
    @URL(message = "图标URL需符合标准格式")
    private String icon;

}